package com.fjxd.plane.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fjxd.feign.clients.FlightNumberClient;
import com.fjxd.plane.mapper.AirlinesMapper;
import com.fjxd.plane.pojo.Airlines;
import com.fjxd.plane.pojo.Plane;
import com.fjxd.plane.service.AirlinesService;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AirlinesServiceImpl extends ServiceImpl<AirlinesMapper, Airlines> implements AirlinesService {
    @Autowired
    private AirlinesMapper airlinesMapper;

    @Override
    public Airlines getAirlinesById(Integer id){
        return airlinesMapper.getAirlinesById(id);
    }

    @Override
    public List<Airlines> getAirlinesAll() {
        return airlinesMapper.selectList(null);
    }

    @Autowired
    private FlightNumberClient flightNumberClient;
    @Override
    public Airlines getAirlinesByName(Integer id) {
        LambdaQueryWrapper<Airlines> queryWrapper=new LambdaQueryWrapper<>();
        queryWrapper.eq(Airlines::getId,id);
        Airlines airlines = airlinesMapper.selectOne(queryWrapper);
        airlines.setHotCityVoList(flightNumberClient.getHotCity(id));

        return airlines;
    }


}
